--[[
VGUI sideways progress bar!
]]

local PANEL = {}

function PANEL:Init()
	self.value = 0
end

function PANEL:PerformLayout()
end

function PANEL:SetValue(val)
	self.value = val
end

function PANEL:SetColour(r, g, b, a)
	self.r = r
	self.g = g
	self.b = b
	self.a = a
end

function PANEL:Paint()
	
	local w, h = self:GetSize()
	
	local fb = self.value * h
	local ft = (100-self.value) * h
	
	surface.SetDrawColor( self.r, self.g, self.b, self.a )
	surface.DrawRect( 0, ft, w, fb )
	
	DPanel.Paint( self )
	
end

local SProgressBar = vgui.RegisterTable( PANEL, "DPanel" )


--[[
This is the VGUI panel for the player stats.
]]

local PANEL = {}

function PANEL:Init()	
	self.Health = vgui.CreateFromTable(SProgressBar, self)
	self.Suit = vgui.CreateFromTable(SProgressBar, self)
	self.Rad = vgui.CreateFromTable(SProgressBar, self)
	
	self.Health:SetColour(255, 0, 0, 128)
	self.Suit:SetColour(0, 0, 255, 128)
	self.Rad:SetColour(0, 255, 0, 128)
	
	self.Health:SetValue(50)
	self.Suit:SetValue(87)
	self.Rad:SetValue(12)
end

function PANEL:PerformLayout()
	self.Health:SetWide(5)
	self.Health:SetTall(100)
	self.Health:AlignTop(5)
	self.Health:AlignRight(5)
	
	self.Suit:SetWide(5)
	self.Suit:SetTall(100)
	self.Suit:AlignTop(5)
	self.Suit:AlignRight(15)
	
	self.Rad:SetWide(5)
	self.Rad:SetTall(100)
	self.Rad:AlignTop(5)
	self.Rad:AlignRight(25)
end

local InfoPanel = vgui.RegisterTable( PANEL, "DPanel" )


--[[
This is the 'Info' VGUI Panel
]]

local PANEL = {}

function PANEL:Init()
	self.InfoPanel = vgui.CreateFromTable(InfoPanel, self)
end

function PANEL:PerformLayout()
	self.InfoPanel:AlignTop(4)
	self.InfoPanel:SetWide(self:GetWide())
	self.InfoPanel:SetTall(400)
end

local CreationSheet = vgui.RegisterTable( PANEL, "Panel" )

local function CreateContentPanel()
	local ctrl = vgui.CreateFromTable( CreationSheet )
	return ctrl
end

spawnmenu.AddCreationTab( "Info", CreateContentPanel, "gui/silkicons/coins", -20 )
